<?php
/*namespace app\admin\org;

use JPush\Client as JPush;
require_once APP_PATH . '/../vendor/autoload.php';
require_once APP_PATH . '/../vendor/jpush/jpush/examples/config.php';
use Think\Controller;

class Jpushs{
    private $app_key="76feaf40b0157f0d2903e889";
    private $master_secret="ba9ad480a40d37280b562314";
    private $client="";


    public function __construct($app_key,$master_secret,$client){

        $this->$app_key        = $app_key;
        $this->$master_secret  = $master_secret;
        $this->$client         = new JPush($this->app_key, $this->master_secret);

    }

    //获取alias和tags
    public function getDevices($registrationID){

        $result = $this->client->device()->getDevices($registrationID);
        return $result;

    }
    //添加tags
    public function addTags($registrationID, $tags){

        $result = $this->client->device()->addTags($registrationID,$tags);
        return $result;

    }

    //移除tags
    public function removeTags($registrationID, $tags){

        $result = $this->client->device()->removeTags($registrationID,$tags);
        return $result;

    }
    //标签推送
    public function push($tag, $alert){

        $tags = implode(",", $tag);
        $this->client->push()
            ->setPlatform(array('ios', 'android'))
            ->addTag($tags)                          //标签
            ->setNotificationAlert($alert)           //内容
            ->send();
    }

    //别名推送
    public function aliasPush($alias, $alert){

        $alias = implode(",",$alias);
        $this->client->push()
            ->setPlatform(array('ios', 'android'))
            ->addAlias($alias)                      //别名
            ->setNotificationAlert($alert)          //内容
            ->send();

    }

}*/